<?php
declare (strict_types = 1);

namespace app\middleware;



use app\lib\Jwt;

class CheckLogin
{
    /**
     * 处理请求
     *
     * @param \think\Request $request
     * @param \Closure       $next
     * @return Response
     */
    public function handle($request, \Closure $next)
    {
        $token=Jwt::getRequestToken();
//        dd($token);
        $data=Jwt::verifyjwt($token)->getData();
        if($data['code']==200){
            return $next($request);
        }
        return fail('请先登录');
    }
}
